<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

var a = ['1', '3', '2'];
var b = ['3', '1', '2'];
var ddd = a.filter(t => b.includes(t));
console.log(ddd);
var c = a.length === b.length && a.filter(t => b.includes(t));

console.log(c); // true


    </script>
</body>
</html>